function postRequest(strURL){
	var xmlHttp;
	if(window.XMLHttpRequest){ // For Mozilla, Safari, ...
		var xmlHttp = new XMLHttpRequest();
	}
	else if(window.ActiveXObject){ // For Internet Explorer
		var xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlHttp.open('POST', strURL, true);
	xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
	xmlHttp.onreadystatechange = function(){
		if (xmlHttp.readyState == 4){
				updatepage(xmlHttp.responseText);
		}
	}
	xmlHttp.send(strURL);
}

function updatepage(str){
	if(str.indexOf("validLogin") != -1){
		window.location="https://secure719.hostgator.com/~sixty06/privr/main.php";
	}else{
		alert("Invalid Login! Please try again!");
	}
}

function call_login(){
	var username = window.document.loginform.username.value;
	//var password = Sha1.hash(window.document.loginform.password.value);
	var password = window.document.loginform.password.value;
	//var token = window.document.loginform.token.value;
	var url = "php/ajax_login.php?username=" + username + "&password=" + password + "&token=1";
	postRequest(url);
}